let app = getApp()
const requireHttps = app.globalData.requireHttps //获取require域名
Page({
  data: {
    startDate: "请选择 >",
    multiArray: [['0:00', '1:00', '2:00', '3:00', '4:00', '5:00', '6:00', '7:00', '8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00', '24:00'], ['0:00', '1:00', '2:00', '3:00', '4:00', '5:00', '6:00', '7:00', '8:00', '9:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00', '24:00']],
    time: [],
    priceVal: ''
  },
  bindStartMultiPickerChange: function(e) {
    let _this = this
    console.log(e)
    //获取用户选择的时间
    _this.data.time = e.detail.value
    _this.setData({
      startDate: '' + _this.data.time[0] + ':00 ~ ' + _this.data.time[1] + ':00'
    })
    // console.log(_this.data.multiArray[0][_this.data.time[0]])
  },
  pickerTap: function(e) {
    console.log(e)
  },
  bindMultiPickerColumnChange: function(e) {
    console.log(e)
  },
  priceVal: function(e) {
    let _this = this
    console.log(e)
    _this.data.priceVal = e.detail.value
  },
  //编辑我的车位
  updateEdit: function() {
    let _this = this
    console.log(_this.data.time)
    wx.request({
      url: '' + requireHttps + '/Api/Member/editClaimParking',
      data: {
        token: app.globalData.token,
        start_hours: _this.data.time[0],
        end_hours: _this.data.time[1],
        price: _this.data.priceVal,
        gp_id: app.globalData.updateId
      },
      method: 'post',
      success: res => {
        // console.log(res)
        wx.showModal({
          title: '提示',
          content: res.data.message,
          success: res => {
            if (res.confirm) {
              wx.navigateBack({
                delta: 1
              })
            } else if (res.cancel) {
              
            }
          }
        })
      }
    })
  }
})
